package com.DuoXianCheng.D15;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class A01 {
    public static void main(String[] args) throws InterruptedException {
       /* // 1.获取线程池对象
        ExecutorService pool1 = Executors.newCachedThreadPool();
        
        // 2.提交任务
        pool1.submit(new C01());
        // Thread.sleep(1000);
        pool1.submit(new C01());
        // Thread.sleep(1000);
        pool1.submit(new C01());
        // Thread.sleep(1000);
        pool1.submit(new C01());
        // Thread.sleep(1000);
        pool1.submit(new C01());
        // Thread.sleep(1000);
        
        // 3.销毁线程池
        // pool1.shutdown();*/
        
        ExecutorService pool2 = Executors.newFixedThreadPool(3);
        pool2.submit(new C01());
        pool2.submit(new C01());
        pool2.submit(new C01());
        pool2.submit(new C01());
        pool2.submit(new C01());
    }
}
